package top.zhmq.orderconsumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
//import top.zhmq.orderconsumer.service.CancelOrderSender;
import top.zhmq.orderconsumer.service.OrderService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 控制层
 *
 * @author Glory
 * @classname OrderController
 * @create 2021-06-07 22:15
 */

@Controller
public class OrderController {
//    @Autowired
//    private CancelOrderSender cancelOrderSender;
    @Autowired
    OrderService orderService;

//    @GetMapping("/customSend")
//    public void send(int orderId) {
//        cancelOrderSender.sendMsg("delay_queue_1", orderId);
//    }

//    @GetMapping(value = "/cancelOrder")
//    @ResponseBody
//    public String cancelOrder(HttpServletRequest request, HttpSession session, int id) {
//        orderService.cancelOrder(id);
//        return "cancel";
//    }

    @GetMapping(value = "/successOrder")
    public String successOrder(int id) {
        orderService.successOrder(id);
        return "redirect:http://localhost:8896/goods/getAllorder";
    }
}
